package com.xy.dao

import java.util
import java.util.{List, Map}

import com.xy.domain.User
import org.mybatis.spring.SqlSessionTemplate
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component

/**
  * Created by xiaoyuan on 2017/11/15.
  */
@Component
class UserMapper {

  @Autowired
  val sqlSessionTemplate:SqlSessionTemplate= null

  def add(user: User): Int={
    sqlSessionTemplate.insert("add",user)
  }

  def update(user: User): Int={
    sqlSessionTemplate.update("update",user)
  }

  def deleteByIds(ids: Array[String]): Int={
    sqlSessionTemplate.delete("deleteByIds",ids)
  }

  def queryUserList(params: util.Map[String, AnyRef]): util.List[User]={
    sqlSessionTemplate.selectList("queryUserList",params);
  }
}
